/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx.ex;

/**
 * <p>Project: javaseapp - Ex100
 * <p>Powered by webrx On 2021-07-30 17:23:22
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 16
 */
public class ExLing2 {
    public static void main(String[] args) {
        int max = 18;
        int spa = max;
        for (int i = 1; i < max; i += 2) {
            --spa;
            for (int k = 1; k < spa; k++) {
                System.out.print(" ");
            }
            String ss = "";
            for (int j = 1; j <= i; j++) {
                ss += "*";
            }
            if (ss.length() >= 3) {
                ss = "*" + " ".repeat(ss.length() - 2) + "*";
            }
            System.out.println(ss);
        }

        for (int i = max - 3; i >= 1; i -= 2) {
            ++spa;
            for (int k = 1; k < spa; k++) {
                System.out.print(" ");
            }

            for (int j = 1; j <= i; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }
}
